<?php
/**
* a file or folder within an archive
*
* @link http://webappkit.net
* @package pathnodes
* @subpackage zip
* @author J.Ducastel <jeremie@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* this pathnode class represents a file within a zip archive
* @uses
*/
class zipChildNode extends pathNode {
/*--------------------------------------------------------------------
CONSTRUCTOR
--------------------------------------------------------------------*/
	/**
	* constructor alias
	* @access public
	*/
	function archiveItemNode(&$parent) {
		$this->__construct($parent);
	}/**/
	
	/**
	* "real" constructor
	* @access public
	*/
	function __construct(&$parent) {
		$this->setParent($parent);
	}/**/
/*--------------------------------------------------------------------
PUBLIC STATIC METHODS
--------------------------------------------------------------------*/
	/**
	* 
	* @static
	* @param
	* @return 
	* /
	function () {
		
	}/**/
/*--------------------------------------------------------------------
PUBLIC INSTANCE METHODS
--------------------------------------------------------------------*/
	/**
	* uncompressed size, in octets
	* @param
	* @access public
	* @return int
	*/
	function size($new=null) {
		if (is_int($new))
			$this->size=$new;
		return $this->size;
	}/**/
	
	/**
	* compressed size, in octets
	* @param
	* @access public
	* @return int
	*/
	function storedSize($new=null) {
		if (is_int($new))
			$this->stored_size=$new;
		return $this->stored_size;
	}/**/
	
	/**
	* uncompressed file name
	* @param string $new
	* @access public
	* @return string
	*/
	function fileName($new=null) {
		if (is_string($new))
			$this->filename=$new;
		return $this->filename;
	}/**/
	
	/**
	* compressed file name
	* @param string $new
	* @access public
	* @return string
	*/
	function storedFileName($new=null) {
		if (is_string($new))
			$this->stored_filename=$new;
		return $this->stored_filename;
	}/**/
	
	/**
	* is a folder ?
	* @param string $new
	* @access public
	* @return string
	*/
	function isFolder($new=null) {
		if (is_bool($new))
			$this->is_folder=$new;
		return $this->is_folder;
	}/**/
	
	/**
	* last modification time
	* @param string $new
	* @access public
	* @return string
	*/
	function mTime($new=null) {
		if (is_int($new))
			$this->mtime=$new;
		return $this->mtime;
	}/**/
	
	/**
	* index within archive
	* @param string $new
	* @access public
	* @return string
	*/
	function index($new=null) {
		if (is_int($new))
			$this->index=$new;
		return $this->index;
	}/**/
	
	/**
	* comment
	* @param string $new
	* @access public
	* @return string
	*/
	function comment($new=null) {
		if (is_string($new))
			$this->comment=$new;
		return $this->comment;
	}/**/
	
	/**
	* extract to string or file
	* @access public
	* @return string
	*/
	function extract() {
		// echo $this->fileName().$this->index();
		$this->content=$this->_parent->extractByIndex($this->index());
		return $this->content;
	}/**/
	
	/**
	* sets or get file content
	* @param string $content optional, new content for file
	* @access public
	* @return string
	*/
	function & content($new=null) {
		if ($new) { // setting content
			$this->content=$new;
			// echo "<p>new content = $new</p>";
		} else if (!$this->content) { // reading content from zip archive
			$this->content=$this->_parent->extractByIndex($this->index());
		}
		return $this->content;
	}/**/

		/**
	*
	* @param
	* @access public
	* @return
	* /
	function () {

	}/**/
/*--------------------------------------------------------------------
VARS / MEMBERS
--------------------------------------------------------------------*/
	/**
	* @var archiveNode parent archive node reference
	*/
	//var $_parent;
	
	/**
	* @var bool is a folder ?
	*/
	var $is_folder=false;
	/**
	* @var int uncompressed size in octets
	*/
	var $size;
	/**
	* @var int compressed size in octets
	*/
	var $stored_size;
	/**
	* @var string uncompressed file name
	*/
	var $filename;
	/**
	* @var string compressed file name
	*/
	var $stored_filename;
	/**
	* @var int last modification timestamp
	*/
	var $mtime;
	/**
	* @var string comment
	*/
	var $comment;
	
/*--------------------------------------------------------------------
PRIVATE / PROTECTED METHODS
--------------------------------------------------------------------*/
	/**
	* 
	* @param
	* @access protected
	* @return 
	* /
	function () {
		
	}/**/
}
?>